package com.monitor.util;

import java.util.ArrayList;
import java.util.List;

public class CalculationTax {

	/**
	 * 计算未税含税单价
	 * @param count 库存数量
	 * @param tax 库存含税单价
	 * @param notax 库存未税单价
	 * @param countr 入库数量
	 * @param price 入库价格
	 * @param type 0增值票 1其它发票或无发票
	 * @return
	 */
	public static List<Double> outStorageCalculationTax(Integer count, double tax, 
			double notax, Integer countr, double price, int type){
		//新未税单价=（库存数量*未税单价+新入库商品增值票数量*单价*0.8547+新入库其它发票或无发票数量*单价）/（库存数量+新入库总数量）
		//新含税单价=（库存数量*含税单价+新入库数量*单价）/（库存数量+新入库数量）
		double notaxNew = 0.00;
		double taxNew = 0.00;
		//新入库商品增值票数量
		if(type == 0){
			notaxNew = (count*notax + countr*price/1.16)/(count+countr);
			taxNew = (count*notax + countr*price)/(count+countr);
		}else{
			notaxNew = (count*notax + countr*price)/(count+countr);
			taxNew = notaxNew;
		}
		List<Double> prices = new ArrayList<Double>();
		prices.add(notaxNew);
		prices.add(taxNew);
		return prices;
	}
}
